#include <stdio.h>
#include <stdlib.h>
#include "merchandise.h"
#include "List.h"

int show_menu();

int main(int argc, char* argv[])
{
    int selection;
    while((selection=show_menu()) != 0) {
        #if OS_WIN
            system("cls");
        #else
            system("clear");
        #endif
        if (merchandise_funs[selection]() == 0) {
            puts("成功!");
        }
        else {
            puts("失败！");
        }
    }
    puts("bye");
    return 0;
}

int show_menu()
{
    puts("=========================xxx管理系统=============================");
    puts("| 1............. 入库                                           |");
    puts("| 2............. 浏览                                           |");
    puts("| 3............. 排序                                           |");
    puts("| 4............. 查询                                           |");
    puts("| 5............. 出库                                           |");
    puts("| 6............. 修改信息                                       |");
    puts("| 0............. 退出                                           |");
    puts("=================================================================");
    int selection = 0;
    do {
        printf("请选择:");
        scanf("%d", &selection);
    }while(selection >6 || selection < 0);
    return selection;
}
